FlashObject = function(dest, SWFpath) {
	
	// destination element
	this.destination = typeof(dest).toLowerCase()=="string" ? document.getElementById(dest) : dest;
	if(!this.destination) {
		if(console) {
			console.log("Element `" + dest + "` not found.");
		}
		return;
	}
	
	// file
	this.swffile = SWFpath;
	
	// attributes
	this.attributes = Array();
	// parameters
	this.parameters = Array();
}
FlashObject.prototype.addParam = function(name, value) {
	this.parameters[name] = value;
}
FlashObject.prototype.addAttr = function(name, value) {
	this.attributes[name] = value;
}

FlashObject.prototype.make = function() {
	
	var html = "";
	html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"';
	for(x in this.attributes) {
		html += " " + x + "=\"" + this.attributes[x] + "\"";
	}
	html += '>';
	
	for(x in this.parameters) {
		html += '<param name="' + x + '" value="' + this.parameters[x] + '" />';
	}
	
	html += '<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"';
	for(x in this.attributes) {
		html += ' ' + x + '="' + this.attributes[x] + '"';
	}
	for(x in this.parameters) {
		var val;
		switch (x) {
			case "movie":
				val = this.parameters[x];
				x = "src";
				break;
			default:
				val = this.parameters[x];
				break;
		}
		html += ' ' + x + '="' + val + '"';
	}
	html += '></embed>';
	
	html += '</object>';
	
	this.destination.innerHTML = html;
}